# 将视频片段在11s以下的进行视频的排列组合，生成总的视频片段
import random
from itertools import product
import numpy as np
import os
import redis
import umsgpack
import pandas as pd
from settings import REDIS_CON, VIDEO_PRE_PATH
embed_data = []

column_name = [
    "id",
    "md5",
    "video_time",
    "embeddings_datas",
    "local_path"
]
# VIDEO_PRE_PATH = r'F:\video\mixkit'


def get_embed_data():
    if len(embed_data) == 0:
        redis_conn = redis.Redis(**REDIS_CON)
        # dataframe转化为hash键值对格式，获取存量数据已经序列化保存到redis内存的数据
        retrieved_data = redis_conn.hget('total_video_embed_tag', 'umsgpack_video_data')
        # 反序列化为字典对象
        deserialized_df_dict = umsgpack.unpackb(retrieved_data)
        # 需要将字典转换为DataFrame
        df = pd.DataFrame(deserialized_df_dict)
        embed_data.append(df)
    return embed_data[0]


class VideoProduce(object):
    def cosine_similarity(self, a, b):
        # 定义余弦相似度函数，进行计算
        result = np.dot(a, b) / (np.linalg.norm(a) * np.linalg.norm(b))
        return result

    # search through the reviews for a specific product
    def top_n_similarity(self, df, user_query, top_n=8):
        df["similarities"] = df.embeddings_datas.apply(lambda x: self.cosine_similarity(x, user_query))
        result_df = df.sort_values("similarities", ascending=False)
        # 判断图片的md5是否重复，如果重复保留排名靠前的图片
        result_df = result_df.drop_duplicates(subset=['md5'])
        top_df = result_df.head(top_n)
        return top_df

    def get_video_path_time(self, result_df):
        video_paths = [os.path.join(VIDEO_PRE_PATH, path) for path in result_df['local_path'].values]
        video_time = result_df['video_time'].values
        return video_paths, video_time

    def generate_video_combinations(self, video_sec, expand_video_paths, video_time):
        # 将字符串形式的时长转换为浮点数
        video_time_float = [float(time) for time in video_time]

        # 生成所有视频的组合
        all_combinations = []
        self.generate_combinations_recursive(video_sec, expand_video_paths, video_time_float, [], 0, all_combinations)


        # print(len(sorted_combinations))
        # print('sorted_combinations', sorted_combinations[0])
        # 返回排序后的组合列表
        return all_combinations

    def generate_combinations_recursive(self, video_sec, video_paths, video_durations, current_combination, index,
                                        all_combinations):
        # 计算当前组合的总时长
        total_duration = sum([video_durations[video_paths.index(video_path)] for video_path in current_combination])
        # 将每个视频的时长也添加到结果中
        video_durations_list = [video_durations[video_paths.index(path)] for path in current_combination]

        # 转场效果需要预留一些时间，将组合添加到结果列表
        if total_duration >= video_sec-1.5 and total_duration <= video_sec:
            all_combinations.append((tuple(current_combination), video_durations_list, total_duration))
            # print(total_duration)

        # 递归生成组合
        for i in range(index, len(video_paths)):
            self.generate_combinations_recursive(video_sec, video_paths, video_durations,
                                                 current_combination + [video_paths[i]], i + 1, all_combinations)

    def run(self, video_sec, embedding):
        embed_df = get_embed_data()
        # 字幕向量转化为浮点数
        input_embedding_float = [float(value) for value in embedding]
        res_df = self.top_n_similarity(embed_df, input_embedding_float, top_n=20)
        expand_video_paths, video_time = self.get_video_path_time(res_df)
        video_combinations = self.generate_video_combinations(video_sec, expand_video_paths, video_time)
        range = len(video_combinations)
        # 从range随机抽取一个数
        random_num = random.randint(0, range-1)
        print('random_num', random_num)
        if range <= 0:
            return None
        # 随机选择一个组合
        random_combination = video_combinations[random_num]
        return random_combination


#
# if __name__ == '__main__':
#     vp = VideoProduce()
#     video_sec = 42.26
#     # 简单尝试是否自定义余弦进行计算
#     input_embedding = [-0.017992863431572914, -0.018807685002684593, -0.002937030978500843, -0.023549679666757584, 0.009924793615937233, 0.005446614697575569, 0.0017231472302228212, 0.006374977063387632, -0.015428178943693638, -0.029280144721269608, 0.0012664798414334655, 0.01645672507584095, 0.0042677950114011765, -0.010178591124713421, 0.0039138151332736015, -0.004301189444959164, 0.010071729309856892, -0.010145196691155434, 0.0053931837901473045, -0.004351280629634857, -0.03131052106618881, 0.008027995936572552, -0.006588700693100691, 0.013043823651969433, -0.009443915449082851, 0.0019752744119614363, 0.00398394325748086, -0.018780969083309174, 0.010712900198996067, 0.00967099703848362, 0.039164867252111435, 0.0013958828058093786, -0.0007267440087161958, -0.014974015764892101, 0.0010060040513053536, -0.013137328438460827, -0.024204207584261894, -0.011981884017586708, 0.0070729185827076435, -0.014613357372581959, 0.007814272306859493, 0.019769441336393356, -0.0050091492012143135, -0.0029403704684227705, -0.020330466330051422, 0.006298169959336519, -0.004281152505427599, -0.009777858853340149, 0.006451783701777458, 0.03553156182169914, 0.016844097524881363, 0.025860566645860672, -0.024591581895947456, 0.0015862304717302322, 0.00897639524191618, -0.00868920423090458, -0.016176212579011917, 0.011574473232030869, 0.01521445531398058, -0.025459835305809975, -0.0017298260936513543, 0.006071088369935751, -0.01931527815759182, 0.006845836993306875, 0.003766880137845874, -0.004037374164909124, -0.01907483860850334, 0.013057181611657143, 0.011574473232030869, 0.02329588308930397, 0.03678718954324722, 0.004287831485271454, 0.011527721770107746, -0.014893869869410992, 0.018593961372971535, 0.00266987644135952, -0.01028545293956995, -0.0219868253916502, 0.005917474627494812, 0.04031363129615784, 0.01170137245208025, -0.022213906049728394, -0.013464592397212982, 0.010071729309856892, 0.003960567060858011, 0.00783430878072977, -0.0053931837901473045, 0.0013190759345889091, -0.006812442559748888, 0.0003888351784553379, -0.008589020930230618, 0.014733577147126198, 0.031070081517100334, 0.004838837776333094, -0.01850045658648014, 0.013745104894042015, 0.01580219529569149, -0.002077127108350396, 0.00953741930425167, -0.019475571811199188, 0.004681884776800871, 0.00518279941752553, -0.015535040758550167, -0.015628544613718987, -0.04015333950519562, -0.0036166056524962187, -0.002178979804739356, 0.006966056767851114, 0.04100823402404785, -0.0023225753102451563, -0.035104114562273026, -0.0029704254120588303, -0.024017199873924255, -0.029680877923965454, -0.025954071432352066, -0.02125214971601963, 0.007279963232576847, -0.005656999070197344, -0.01858060248196125, 0.003549817018210888, 0.03598572686314583, 0.013451234437525272, 0.009190118871629238, -0.01936870999634266, 0.004347941372543573, 0.019475571811199188, 0.00012293286272324622, -0.021799815818667412, -0.007640622090548277, -0.009938151575624943, 0.026034217327833176, 0.0038470264989882708, -7.409365935018286e-05, 0.007627264130860567, -0.033795058727264404, 0.017886001616716385, 0.009483988396823406, 0.024257639423012733, -0.03192497789859772, -0.004588380455970764, 0.001818321063183248, 0.0273833479732275, -0.02288179285824299, -0.006091125309467316, 0.0048822504468262196, 0.005493366625159979, -0.007466971408575773, 0.02594071254134178, 0.01858060248196125, 0.00834858138114214, 0.00864913035184145, -0.023669898509979248, 0.018914546817541122, 0.01797950640320778, -0.002417749259620905, 0.006498536095023155, -0.016603659838438034, 0.010672827251255512, -0.031070081517100334, 0.007433576975017786, 0.024671727791428566, -0.0076940529979765415, -0.005900777410715818, -0.010452424176037312, 0.03205855190753937, 0.019275205209851265, 0.0022474383004009724, -0.005212854593992233, 0.024444647133350372, 0.01708453707396984, -0.005533440038561821, 0.032192129641771317, -0.03269972652196884, 0.004351280629634857, -0.005650320090353489, 0.006157913710922003, 0.0059041171334683895, 0.011868343688547611, -0.024230923503637314, -0.036653611809015274, -0.010719578713178635, -0.014840438961982727, 0.00655196700245142, 0.021893320605158806, -0.002863563597202301, -0.006067749112844467, 0.025807134807109833, -0.024805305525660515, 0.009083257056772709, 0.0045048948377370834, 0.005847346503287554, 0.020303750410676003, 0.0005848181317560375, -0.015655260533094406, -0.6420259475708008, -0.01510759349912405, 0.009764500893652439, -0.01634986326098442, 0.008221683092415333, 0.025045745074748993, 0.01098005473613739, 0.0030338745564222336, -0.011227172799408436, -0.019221775233745575, -0.011834949254989624, -0.009717749431729317, 0.0026231242809444666, 0.008295150473713875, -0.0003548147215042263, -0.015147666446864605, -0.0006445104954764247, -0.016443366184830666, -0.003499725367873907, 0.025179322808980942, -0.0037268069572746754, 0.00026986791635863483, 0.011741445399820805, -0.013204116374254227, -0.002077127108350396, 0.0010577653301879764, 0.0033577994909137487, -0.009891399182379246, -0.03817639499902725, 0.03582543507218361, -0.042263858020305634, -0.002143915742635727, 0.005930832587182522, 0.0007739135180599988, 0.05685050040483475, 0.01918170042335987, -0.022921865805983543, 0.025593411177396774, 0.009597529657185078, 0.024124061688780785, -0.008889569900929928, -0.007106312550604343, -0.016002561897039413, -0.009256907738745213, -0.006638792343437672, 0.028264958411455154, 0.026434948667883873, -0.002534629311412573, -0.006732296198606491, -0.02435114234685898, 0.008154894225299358, -0.006979414261877537, -0.0201300997287035, 0.011507685296237469, 0.01902140863239765, 0.007520402316004038, 0.010619396343827248, -0.014853796921670437, 0.008755992166697979, 0.025072460994124413, -0.0032926807180047035, 0.003493046620860696, -0.01367831602692604, 0.0015620195772498846, -0.032432571053504944, 0.011066880077123642, -0.016323147341609, -0.01585562713444233, 0.016737235710024834, -0.03860384225845337, -0.005980923771858215, 0.012596339918673038, -0.013110612519085407, -0.011828270740807056, 0.007720768451690674, 0.03697419911623001, 0.027236413210630417, -0.012122140266001225, 0.003082296345382929, 0.008355260826647282, -0.0060510518960654736, -0.006675526034086943, -0.00233927252702415, -0.018794327974319458, 0.01518773939460516, -0.005426578223705292, -0.01569533348083496, -0.024591581895947456, -0.003392863553017378, -0.01596248894929886, 0.018901189789175987, -0.013210795819759369, 0.00137083709705621, -0.004180969670414925, 0.01108691655099392, 0.03147081285715103, 0.0028485360089689493, 0.008902927860617638, 0.024404574185609818, -0.004641811363399029, -0.03299359604716301, -0.005480009131133556, 0.02277493104338646, -0.009824611246585846, 0.011861665174365044, 0.013918755576014519, -0.016683805733919144, 0.006845836993306875, 0.04386678710579872, 0.0004378831072244793, -0.026849038898944855, -0.002800114220008254, -0.025780420750379562, -0.0009200136992149055, 5.353528104024008e-05, -0.03026861697435379, 0.030802926048636436, -0.008041353896260262, 0.024471363052725792, -0.016550227999687195, 0.0021372369956225157, -0.00598760275170207, 0.018593961372971535, 0.010338883846998215, 0.03411564230918884, 0.008448764681816101, -0.02749020978808403, -0.004438105970621109, 0.0016413311241194606, 0.004147575236856937, -0.004411390516906977, 0.0020103384740650654, 0.015508325770497322, 0.0012973695993423462, 0.0067523326724767685, 0.01912827044725418, -0.011881701648235321, -0.022841719910502434, 0.002194007160142064, -0.017912717536091805, -0.015708690509200096, -0.03050905652344227, 0.013584812171757221, -0.0051627629436552525, -0.015842268243432045, -0.01800622045993805, -0.023309240117669106, -0.002150594722479582, -0.020277034491300583, 0.004905626643449068, -0.01228911243379116, -5.483974746312015e-05, 0.00010456598829478025, 0.01280338503420353, 0.03427593782544136, -0.00291532464325428, -0.011534400284290314, -0.0207044817507267, -0.013344372622668743, -0.02626129798591137, 0.0039138151332736015, 0.007206495851278305, 0.0002663197519723326, -0.04947703331708908, -0.028131380677223206, 0.00038278248393908143, -0.015481609851121902, -0.010024976916611195, 0.011066880077123642, -0.036252882331609726, -0.00729332072660327, 0.007440255954861641, -0.016229642555117607, -0.005289661232382059, -0.026608599349856377, 0.02460494078695774, -0.018954619765281677, -0.017017748206853867, -0.0017999542178586125, -0.012342543341219425, -0.008428728207945824, -0.00994483008980751, -0.014172552153468132, -0.004995791241526604, 0.011834949254989624, -0.010499176569283009, 0.02898627519607544, 0.004942360334098339, -0.0030906449537724257, 0.016470082104206085, -0.0055835312232375145, 0.017097895964980125, -0.010018298402428627, -0.008168252184987068, 0.016790667548775673, 0.021719669923186302, -0.014426348730921745, -0.0078743826597929, -0.014880511909723282, 0.008395333774387836, 0.007740804925560951, 0.011240530759096146, 0.011507685296237469, -0.005219533108174801, 0.034943822771310806, -0.027971088886260986, 0.018406953662633896, -0.020984994247555733, 0.00953741930425167, 0.006912625394761562, 0.029387008398771286, -0.0003694247279781848, -0.0033310840371996164, 0.002314226934686303, -0.005249588284641504, 0.011480969376862049, 0.006905946880578995, 0.020116742700338364, -0.02138572745025158, 0.006919304374605417, -0.00428449222818017, -0.019034765660762787, 0.011861665174365044, -0.012603018432855606, 0.0027233073487877846, 0.015374748036265373, 0.008108142763376236, 0.017525343224406242, 0.022494418546557426, -0.0171646848320961, 0.006645470857620239, 0.02767721749842167, 0.017071180045604706, 0.004828819539397955, -0.015361390076577663, -0.013304299674928188, 0.020223604515194893, -0.02329588308930397, 0.022294051945209503, 0.018433667719364166, 0.005767200142145157, 0.03277987241744995, 0.011821591295301914, -0.023856906220316887, 0.028585543856024742, -0.005296340212225914, 0.035077400505542755, 0.0032442589290440083, -0.0057772183790802956, 0.001255626673810184, -0.018273375928401947, -0.001067783567123115, -0.016242999583482742, 0.010485818609595299, 0.0019352012313902378, -0.014787008054554462, 0.011120310984551907, -0.008114821277558804, 0.004748673178255558, 0.03352790325880051, 0.01522781327366829, 0.012876852415502071, 0.013611527159810066, 0.022788288071751595, -0.015334675088524818, -0.01645672507584095, -0.02364318259060383, -0.01377181988209486, 0.019609149545431137, -0.023830192163586617, 0.02555333822965622, 0.005957548040896654, -0.010452424176037312, 0.010552607476711273, -0.02552662417292595, 0.019983164966106415, -0.006638792343437672, 0.02007666975259781, -0.003073947736993432, 0.026301370933651924, 0.004047392401844263, -0.00359322945587337, 0.012362579815089703, 0.028238242492079735, -0.01179487630724907, -0.006284812465310097, 0.0050091492012143135, -0.004955718293786049, -0.015762122347950935, 0.02187996357679367, 0.013718388974666595, 0.01438627578318119, 0.0004011493583675474, 0.03040219470858574, 0.01377181988209486, -0.018540529534220695, 0.019382067024707794, -0.006418389733880758, -0.024391215294599533, -0.0070729185827076435, -0.01847374066710472, -0.010926623828709126, 0.008896248415112495, -0.02138572745025158, 0.01797950640320778, 0.010599358938634396, 0.002763380529358983, 0.008682524785399437, 0.00033811756293289363, -0.006381656043231487, -0.0005998456035740674, -0.020717840641736984, -0.009223513305187225, 0.011681335046887398, 0.0187141802161932, 0.0034963861107826233, -0.01844702661037445, -0.017552057281136513, 0.024311069399118423, 0.028665689751505852, -0.002646500477567315, -0.01035224087536335, -0.032245561480522156, 0.02316230535507202, 0.0748567208647728, 0.018807685002684593, -0.006308188196271658, 0.013972186483442783, 0.0059775845147669315, 0.003816971555352211, -0.055568158626556396, -0.02917328290641308, 0.008488837629556656, -0.0201300997287035, 0.004164272453635931, 0.004551646765321493, 0.02765050157904625, -0.014038975350558758, 0.025232752785086632, 0.0059775845147669315, 0.004190987907350063, 0.012208965606987476, 0.021399084478616714, 0.003391193924471736, -0.005463311914354563, -0.011093595065176487, -0.011888380162417889, 0.012603018432855606, 0.015147666446864605, -0.025219395756721497, 0.016763951629400253, 0.037909239530563354, 0.009350411593914032, -0.012188929133117199, 0.014306129887700081, 0.01640329323709011, -0.011941811069846153, -0.00864913035184145, -0.0004658508696593344, -0.013865324668586254, 0.017418481409549713, 0.01800622045993805, 0.03879084810614586, 0.02411070466041565, 0.0158823411911726, 0.03438279777765274, 0.00562694389373064, 0.005840667523443699, 0.02413741871714592, -0.006007639225572348, 0.009296980686485767, -0.006428407970815897, -0.006508554331958294, -0.02465837076306343, 0.03171125426888466, 0.02416413463652134, -0.0032743136398494244, -0.014038975350558758, 0.018674107268452644, 0.027062762528657913, -0.0017264867201447487, 0.0018767612054944038, 0.009777858853340149, -0.05075937509536743, -0.0015778819797560573, -0.058293137699365616, -0.0059408508241176605, -0.008188288658857346, -0.008215004578232765, -0.028665689751505852, 0.00427113426849246, -0.011915096081793308, -0.023963768035173416, -0.005316376686096191, -0.0225612074136734, -0.005132708232849836, -0.04995791241526604, -0.019088197499513626, 0.008201646618545055, -0.003145745489746332, 0.0006365793524309993, 5.285695806378499e-05, -0.005226212088018656, 0.017645562067627907, 0.00044790140236727893, 0.018206587061285973, -0.022627996280789375, -0.02457822486758232, 0.0025747024919837713, 0.027196340262889862, -0.025379687547683716, -0.016242999583482742, -0.009083257056772709, -0.008315186947584152, 0.016229642555117607, -0.005176120437681675, 0.026768893003463745, 0.016884172335267067, 0.002729986095800996, -0.0007872712449170649, 0.01834016479551792, -0.0007179780513979495, 0.005109332036226988, -0.017231471836566925, 0.007513723336160183, -0.06197987124323845, -0.015708690509200096, 0.00603435467928648, -0.0031591032166033983, 0.011614547111093998, -0.026795607060194016, 0.021505946293473244, -0.01318407990038395, -0.007961207069456577, 0.04803439974784851, -0.01713796891272068, 0.019488928839564323, -0.0027116192504763603, 0.008996431715786457, 0.011420859955251217, 0.006905946880578995, 0.015735406428575516, 0.019195059314370155, -0.011955169029533863, 0.00968435499817133, -0.01590905711054802, 0.0035130830947309732, 0.04111509397625923, 0.00022958600311540067, 0.010118480771780014, 0.027196340262889862, -0.02460494078695774, -0.016844097524881363, 0.016283074393868446, -0.02245434559881687, 0.020891491323709488, -0.016897529363632202, -0.03160439059138298, -0.04667191207408905, -0.01168801449239254, 0.016416650265455246, 0.0032993594650179148, -0.0017131289932876825, -0.022494418546557426, -0.029574016109108925, 0.023990483954548836, -0.002108851680532098, 0.013270905241370201, 0.01378517784178257, -0.033688195049762726, -0.006585361436009407, 0.0012239021016284823, -0.03593229502439499, 0.03820310905575752, -0.0077741993591189384, 0.020477401092648506, -0.01839359477162361, 0.003873741952702403, -0.004478179384022951, -0.02694254368543625, -0.020303750410676003, -0.028051234781742096, 0.005523421801626682, -0.0053197164088487625, 0.039031289517879486, -0.0070261661894619465, 0.01942213997244835, 0.014092406257987022, 0.017832569777965546, 0.0017415141919627786, -0.003506404347717762, -0.012449405156075954, -0.014947300776839256, 0.004040713422000408, 0.007126349490135908, 0.010085086338222027, 0.0006841662689112127, -0.010492497123777866, 0.009350411593914032, 0.00955077726393938, -0.009016468189656734, 0.011287282221019268, 0.009844647720456123, -0.04509569704532623, -0.020397255197167397, -0.009677675552666187, -0.018460383638739586, -0.004511573351919651, -0.018807685002684593, -0.020998353138566017, 0.03748179227113724, 0.009744464419782162, 0.02552662417292595, -0.00824171956628561, 0.01834016479551792, -0.017391765490174294, -0.01110027451068163, 0.009009789675474167, 0.022374199703335762, -0.03750850632786751, -0.01055928599089384, -0.028238242492079735, -0.0014902218244969845, 0.03590558096766472, 0.022708142176270485, 0.007433576975017786, 0.019595790654420853, 0.0006937671569176018, -0.006668847054243088, 0.02610100619494915, -0.005012488458305597, -0.011153705418109894, -0.016256358474493027, -0.005503384862095118, -0.006124519743025303, -0.009437236934900284, 0.008041353896260262, -0.024017199873924255, 0.010225342586636543, -0.003260955912992358, 0.001046077231876552, 0.019569074735045433, -0.028612259775400162, -0.009363769553601742, 0.003314386820420623, -0.018046293407678604, 0.04637804254889488, -0.017645562067627907, 0.019488928839564323, 0.02893284521996975, 0.020637694746255875, -0.029574016109108925, -0.02075791358947754, 0.008261756040155888, -0.006705580744892359, 0.04266459122300148, 0.041943274438381195, -0.009918115101754665, -0.023442817851901054, 0.0014059011591598392, 0.02566020004451275, -0.005683714523911476, -0.00884281750768423, 0.013331015594303608, 0.00894967932254076, -0.011854985728859901, -0.013190759345889091, -0.02217383310198784, -0.02073119767010212, 0.013310978189110756, 0.008027995936572552, -0.02007666975259781, -0.016950959339737892, -0.035130832344293594, -0.024805305525660515, 0.0012531221145763993, -0.014306129887700081, 0.02903970703482628, 0.02424428053200245, -0.017672277987003326, 0.010492497123777866, -0.004952378571033478, -0.025059102103114128, 0.01508087757974863, 0.016857456415891647, 0.01266980729997158, -0.00020287053484935313, 0.007032845169305801, 0.022160476073622704, 0.01784592866897583, -0.02735663205385208, 0.018487099558115005, 0.008007959462702274, 0.04042049124836922, -0.011407501995563507, -0.026635315269231796, 0.0018083028262481093, 0.008088106289505959, 0.04172955080866814, -0.011634583584964275, -0.0074936868622899055, -0.01978279836475849, -0.007213174365460873, -0.03048234060406685, 0.01763220503926277, 0.009650960564613342, -0.004658508580178022, 0.0017632204107940197, 0.007380146067589521, 0.02201353944838047, -0.005409881006926298, -0.012188929133117199, 0.001753202173858881, -0.02688911184668541, 0.010405671782791615, -0.012148856185376644, 0.006224702578037977, -0.0095774931833148, -0.007961207069456577, 0.008041353896260262, 0.006992772221565247, 0.019876303151249886, -0.018593961372971535, 0.012416010722517967, -0.019822873175144196, 0.004792085848748684, -0.012723238207399845, -0.0007530420552939177, 0.016657089814543724, -0.011621225625276566, 0.03582543507218361, -0.01590905711054802, -0.0036833942867815495, -0.0009684354881756008, 0.006662168074399233, 0.003830329282209277, -0.013210795819759369, 0.0033444417640566826, 0.03323403373360634, -0.018593961372971535, -0.012422689236700535, 0.008729277178645134, -0.02253449149429798, 0.02280164696276188, -0.005536779295653105, -0.016523512080311775, 0.01847374066710472, -0.02413741871714592, 0.0023543001152575016, 0.009470631368458271, 0.023042084649205208, -0.010372278280556202, -0.03676047548651695, -0.012142176739871502, 0.013130648992955685, 0.02214711718261242, 0.007640622090548277, -0.017538700252771378, -0.01593577302992344, -0.022374199703335762, -0.018219944089651108, 0.007567154243588448, 0.0048455167561769485, -0.011721408925950527, 0.010926623828709126, 0.047553520649671555, 0.007139706984162331, -0.0066354526206851006, -0.000739266921300441, -0.014306129887700081, -0.014626715332269669, -0.01719139888882637, -0.03697419911623001, -0.0044247484765946865, -0.009183439426124096, 0.014787008054554462, 0.013123970478773117, -0.008729277178645134, -0.017311619594693184, -0.00854226853698492, -0.04127538949251175, -0.030829641968011856, -0.008468801155686378, 0.011273924261331558, -0.0023843548260629177, -0.0036399816162884235, -0.008943000808358192, 0.01637657731771469, 0.006845836993306875, 0.012015278451144695, 0.006992772221565247, 0.007927813567221165, 0.014947300776839256, -0.026461664587259293, -0.009116651490330696, 0.013611527159810066, -0.02196010947227478, -0.003586550708860159, 0.012522872537374496, 0.012322506867349148, -0.02885269746184349, 0.005920814350247383, -0.009063220582902431, -0.0017565415473654866, 0.0017615507822483778, 0.021185360848903656, -8.040727698244154e-05, -0.013384446501731873, 0.026007501408457756, -0.03277987241744995, -0.01645672507584095, -0.004638472106307745, -0.012536230497062206, -0.02007666975259781, 0.00685251597315073, -0.02318902127444744, -0.005646980833262205, 0.016122780740261078, -0.012295790947973728, -0.007032845169305801, 0.0014977355021983385, 0.008355260826647282, 0.004411390516906977, -0.007974565029144287, 0.0004904791712760925, 0.04175626486539841, 0.024484720081090927, 0.005990942008793354, -0.005934171844273806, -0.01025873702019453, -0.028318388387560844, -0.020557546988129616, -0.004013997968286276, -0.027049405500292778, 0.01640329323709011, -0.016576943919062614, 0.010479140095412731, -0.019662579521536827, 0.0051560839638113976, 0.007273284252732992, -0.004214364103972912, 0.0012464432511478662, 0.009691033512353897, 0.010298809967935085, -0.007727446965873241, 0.007633943110704422, -0.027343275025486946, -0.018954619765281677, -0.007306678686290979, -0.019195059314370155, 0.0011562785366550088, -0.014947300776839256, -0.016389936208724976, -0.003713449230417609, -0.01708453707396984, -0.002830169163644314, -0.014252698980271816, 0.025112533941864967, -0.014119121246039867, 0.010853156447410583, 0.24257639050483704, 0.0002825995034072548, 0.001981953391805291, 0.026354802772402763, 0.0032509376760572195, 0.03577200323343277, 0.02754363976418972, 0.008141537196934223, 0.020383896306157112, -0.011407501995563507, -0.00724656879901886, -0.0005873227491974831, -0.007266605272889137, -0.0006482673925347626, -0.0038269897922873497, -0.032646294683218, -0.023442817851901054, -0.021946750581264496, -0.026434948667883873, -0.02882598340511322, 0.0008390324655920267, -9.246054105460644e-05, 0.012703201733529568, -0.02898627519607544, 0.0002911567862611264, 0.00724656879901886, -0.018019579350948334, -0.021572735160589218, 0.033581335097551346, 0.026662031188607216, -0.020343823358416557, -0.007426898460835218, 0.014947300776839256, 0.004929002840071917, -0.01200192142277956, -0.017485270276665688, 0.002020356711000204, 0.02007666975259781, 0.016804024577140808, 0.01351134479045868, -0.005232891067862511, 0.007587191183120012, 0.010252058506011963, -0.01336440909653902, 0.020263677462935448, 0.014359560795128345, -0.012943641282618046, -0.00458504119887948, -0.01125388778746128, 0.004985773004591465, -0.0018300090450793505, -0.0026381518691778183, 0.020250320434570312, 0.036653611809015274, 0.006905946880578995, 0.025085818022489548, 0.0012439386919140816, 0.04277145490050316, 0.00724656879901886, 0.0219868253916502, -0.017017748206853867, 0.03593229502439499, -0.026007501408457756, 0.011487648822367191, -2.1797624867758714e-05, -0.002901966916397214, -0.015361390076577663, 0.016363220289349556, 0.016763951629400253, 0.0035531562753021717, 0.006508554331958294, -0.043225616216659546, -0.017779139801859856, 0.003927172627300024, -0.03937859088182449, -0.029199998825788498, 0.04287831485271454, 0.02054418995976448, 0.027757365256547928, 0.04378664121031761, -0.009136687964200974, 0.012329185381531715, -0.018593961372971535, -0.008562305010855198, -0.00012063700705766678, -0.023696614429354668, 0.017832569777965546, -0.0011930123437196016, -0.008275113999843597, -0.018967976793646812, 0.004725297447293997, -0.021399084478616714, -0.004074107855558395, -0.002360978862270713, 0.005276303738355637, 0.024417931213974953, 0.0017181381117552519, 0.002957067685201764, -0.010252058506011963, 0.00826843548566103, -0.03585214912891388, 0.018073009327054024, 0.03670704364776611, 0.02887941338121891, -0.01651015505194664, -0.0011880032252520323, -0.018273375928401947, 0.015361390076577663, 0.013477950356900692, -0.009590850211679935, -0.014680146239697933, -0.0178726427257061, 0.007239889819175005, 0.003629963379353285, 0.0008352755685336888, 0.03700091317296028, 0.0051994966343045235, -0.02062433585524559, -0.002995471004396677, -0.008943000808358192, 0.014666788280010223, -0.018353521823883057, -0.019849587231874466, 0.008101463317871094, 0.009109972044825554, -0.017525343224406242, -0.0060209971852600574, 0.020170172676444054, 0.010018298402428627, -0.050011344254016876, 0.033875204622745514, -0.00760722765699029, 0.0039004574064165354, -0.020931564271450043, -0.02190667763352394, 0.01057264395058155, 0.010198627598583698, 0.011480969376862049, -0.013344372622668743, 0.026581883430480957, -0.008548947982490063, -0.01585562713444233, -0.00284352689050138, 0.0034763494040817022, 0.014974015764892101, -0.02560677006840706, 0.004337923135608435, 0.0005213689291849732, 0.0024010520428419113, -0.010138517245650291, -0.01198856346309185, 0.00967099703848362, -0.0054666511714458466, -0.004762031137943268, 0.012623055838048458, -0.015895700082182884, -0.01868746429681778, -0.02075791358947754, -0.031070081517100334, 0.004264455288648605, -0.030642634257674217, -0.008168252184987068, 0.01208206731826067, -0.02392369508743286, -0.021599451079964638, -0.005005809478461742, -0.17162013053894043, 0.00015037882258184254, 0.01370503194630146, -0.026768893003463745, -0.0027533622924238443, -0.01158115267753601, 0.017071180045604706, 0.0171646848320961, -0.021866604685783386, 0.009323695674538612, 0.003636642126366496, -0.010031655430793762, -0.019141627475619316, 0.008602378889918327, 0.013244190253317356, 0.014533210545778275, 0.007887739688158035, 0.028211526572704315, 0.017391765490174294, -0.0017047803848981857, 0.003356129862368107, -0.02743677794933319, -0.018700823187828064, 0.00854226853698492, -0.004478179384022951, 0.004621774889528751, -0.013758462853729725, 0.011133668944239616, 0.0029754345305263996, -0.01986294612288475, 0.0013265896122902632, -0.019462212920188904, 0.025005672127008438, 0.006541948765516281, 0.01844702661037445, 0.01651015505194664, -0.007032845169305801, -0.004985773004591465, -0.01297035627067089, 0.015348032116889954, 0.023002011701464653, 0.04004647582769394, 0.0035898901987820864, 0.018540529534220695, -0.005269624758511782, 0.014132479205727577, 0.009096615016460419, 0.0046885632909834385, 0.012522872537374496, -0.009176760911941528, 0.009737785905599594, -0.040500640869140625, 0.010345562361180782, 0.012536230497062206, 0.02059761993587017, 0.0018416971433907747, 0.009123330004513264, -0.009216833859682083, -0.0037201279774308205, -0.013932113535702229, -0.0191549863666296, -0.008121499791741371, -5.494410288520157e-05, -0.004805443808436394, -0.028264958411455154, -0.01811308227479458, -0.01297035627067089, 0.004354620352387428, -0.003038883674889803, 0.003212534124031663, -0.007179780397564173, -0.03040219470858574, 0.01230247039347887, -0.02073119767010212, -0.002429437357932329, -0.002202355768531561, -0.013731746934354305, 0.007800914812833071, 0.006278133485466242, 0.006959377788007259, -0.0035464775282889605, 0.011080238036811352, -0.018901189789175987, -0.007674016058444977, 0.002628133399412036, 0.005790576338768005, 0.0027800777461379766, 0.0014301120536401868, 0.0012589661637321115, -0.019716011360287666, 0.012636412866413593, -0.01811308227479458, -0.017645562067627907, -0.0036199449095875025, -0.008595699444413185, 0.025673558935523033, -0.00529300095513463, 0.0008916285005398095, 0.008862853981554508, -0.0021172002889215946, 0.0006232216255739331, -0.012442725710570812, -0.032352425158023834, 0.015388105995953083, 0.013411161489784718, 0.0026965918950736523, 0.01797950640320778, 0.02350960671901703, 0.02460494078695774, -0.010579322464764118, -0.04520256072282791, 0.006388334557414055, 0.031096797436475754, 0.015267886221408844, -0.011514363810420036, 0.012830100022256374, -0.010893229395151138, -0.019582433626055717, 0.011193778365850449, 0.011741445399820805, 0.03462323918938637, -0.0018851096974685788, -0.012850136496126652, -0.006912625394761562, 0.010719578713178635, -0.014225983060896397, -0.06716267019510269, -0.01648343913257122, 0.02364318259060383, 0.026421591639518738, -0.00344963395036757, 0.018313448876142502, 0.00017855528858490288, -0.002820150926709175, -0.00392383337020874, 0.03034876473248005, -0.004782067611813545, -0.023309240117669106, -0.01651015505194664, -0.02091820538043976, 0.012135498225688934, 0.000656198535580188, -0.006892588920891285, 0.010606038384139538, -0.01703110709786415, 0.03336761146783829, -0.0055935499258339405, -0.021265506744384766, -0.0071530649438500404, -0.005770539864897728, -0.0158823411911726, 0.036466605961322784, -0.03294016420841217, 0.004745333921164274, 0.01208206731826067, -0.020984994247555733, 0.006892588920891285, -0.019034765660762787, 0.017511984333395958, -0.03953888267278671, 0.015468251891434193, 0.003080626716837287, 0.009717749431729317, -0.03713449090719223, 0.003269304521381855, -0.03545141592621803, -0.004494876600801945, -0.007994601503014565, 0.02389698103070259, -0.027837511152029037, -0.005656999070197344, 0.0017047803848981857, -0.023255808278918266, 0.017258187755942345, -0.009003110229969025, -0.01664373278617859, -0.01596248894929886, 0.01197520550340414, 0.0051260292530059814, -0.027156267315149307, 0.01882104203104973, -0.021759742870926857, 0.01520109735429287, -0.003700091503560543, -0.01228911243379116, -0.011093595065176487, 0.005493366625159979, -0.010592680424451828, -0.014680146239697933, 0.03392863646149635, 0.026501737534999847, -0.01855388842523098, -0.035050686448812485, -0.014346202835440636, 0.02133229561150074, -0.008562305010855198, -0.0015110932290554047, 0.01991637609899044, -0.013758462853729725, 0.012422689236700535, -0.0302151869982481, -0.012462763115763664, -0.01771235093474388, -0.016683805733919144, 0.028612259775400162, 0.00398394325748086, -0.01197520550340414, -0.02280164696276188, 0.0010452424176037312, 0.005256266798824072, -0.016924245283007622, 0.023656541481614113, -0.001536139054223895, 0.0012364248977974057, 0.018487099558115005, -0.02898627519607544, 0.01882104203104973, 0.022975297644734383, -0.015454893931746483, -0.02379011921584606, 0.0053564500994980335, -0.009497346356511116, 0.00925022829324007, -0.007386825047433376, -0.021612808108329773, 0.017071180045604706, 0.008188288658857346, -0.0368940532207489, -0.08260420709848404, 0.00867584627121687, -0.0013599839294329286, 0.006575342733412981, 0.0050892955623567104, 0.004598398692905903, 0.010439066216349602, -0.00014286510122474283, -0.0030839659739285707, -0.008201646618545055, -0.02177310176193714, 0.0076473006047308445, -0.004858874715864658, 0.007239889819175005, 0.005920814350247383, -0.006435086950659752, 0.01648343913257122, -0.02258792333304882, 0.0095774931833148, -0.00133493822067976, 0.016443366184830666, -0.0054733301512897015, -0.004047392401844263, 0.007286642212420702, -0.00759386969730258, 0.00026611104840412736, -0.00249622599221766, 0.015895700082182884, -4.3490894313436e-05, -0.007480329368263483, 0.005416559986770153, -0.01438627578318119, 0.020397255197167397, 0.021505946293473244, 0.02424428053200245, -0.00927694421261549, 0.01653687097132206, 0.029894601553678513, -0.013878682628273964, 0.02895955927670002, -0.0225612074136734, -0.034997254610061646, 0.002770059509202838, -0.025246111676096916, -0.0197293683886528, -0.005960887297987938, -0.025954071432352066, -0.005693732760846615, 0.031203659251332283, 0.004013997968286276, 0.017338333651423454, 0.008943000808358192, -0.012021957896649837, -0.02222726307809353, -0.00015006575267761946, -0.0024411252234131098, 0.021719669923186302, 0.024778589606285095, 0.016283074393868446, -0.01942213997244835, 0.014706861227750778, 0.007787556853145361, 0.021078499034047127, -0.0054365964606404305, 0.000490896578412503, 0.02898627519607544, -0.011240530759096146, -0.0011654619593173265, 0.014733577147126198, -0.019675936549901962, -0.007567154243588448, -0.017391765490174294, 0.002693252405151725, 0.019328637048602104, -0.003730146214365959, 0.003703430760651827, -0.019716011360287666, 0.0031373968813568354, -0.03029533289372921, 0.04111509397625923, 0.010579322464764118, -0.009223513305187225, -0.01735169254243374, 0.014827081002295017, 0.011968526989221573, 0.04298517853021622, -0.023629825562238693, 0.0049256631173193455, 0.003556495765224099, 0.015388105995953083, -0.026301370933651924, 0.004050731658935547, 0.00011980214912910014, 0.007513723336160183, -0.007727446965873241, 0.006728956941515207, -0.026621956378221512, 0.0023776760790497065, 0.022841719910502434, 0.017525343224406242, 0.012242360040545464, 0.0062881517224013805, 0.01096669677644968, -0.017485270276665688, -0.009103293530642986, 0.006181289907544851, -0.015040804632008076, -0.004401372279971838, -0.0012656450271606445, 0.01737840846180916, 0.00826843548566103, -0.0043412623926997185, -0.017071180045604706, 0.002786756493151188, -0.020450685173273087, 2.77198992648664e-08, 0.0062380600720644, -0.009837968274950981, -0.028131380677223206, 0.03860384225845337, 0.011561116203665733, 0.014426348730921745, 0.036413174122571945, -0.018046293407678604, 0.03606587275862694, 0.007887739688158035, -0.0015177720924839377, -0.03852369636297226, 0.02497895620763302, -0.022908508777618408, -0.004227721597999334, 0.00817493163049221, 0.025192679837346077, 0.0021272185258567333, -0.013564775697886944, 0.0011195448460057378, -0.02073119767010212, 0.022400913760066032, -0.007099634036421776, 0.06903275102376938, 0.012162214145064354, -0.0048221405595541, 0.0021272185258567333, -0.0036399816162884235, -0.0008807753911241889, 0.020330466330051422, 0.01138746552169323, -0.020984994247555733, -0.002062099752947688, 0.019569074735045433, -0.03734821453690529, 0.017592132091522217, -0.020343823358416557, -0.019328637048602104, -0.014573284424841404, -0.005239570047706366, 0.05882744491100311, -0.024043915793299675, -0.003391193924471736, 0.03892442584037781, 0.018954619765281677, 0.03582543507218361, 0.008882890455424786, -0.01075965166091919, -0.007533760275691748, 0.004007318988442421, -0.014266056008636951, -0.005877401679754257, -0.022347483783960342, 0.014974015764892101, -0.00512268953025341, -0.04563000798225403, -0.01580219529569149, 0.001666376949287951, 0.012088745832443237, 0.01367831602692604, 0.004524931311607361, 0.008722597733139992, 0.013397803530097008, 0.02389698103070259, -0.017992863431572914, -0.03018847107887268, -0.02683568000793457, -0.012362579815089703, -0.008428728207945824, -0.002157273469492793, -0.040260199457407, -0.028371820226311684]
#     vp.run(video_sec, input_embedding)


